Fixing Linux error for USB drives: "No space left on device"

but windows was just fine...

Home About Projects Blog Games Contact Support

I could not write new test disk images to my usb drives, using the default /dev/sdX or /dev/sdX# devices. cp, dd, etc. did not work, and only wrote a max of 10MB at a time.

It turned out that there was a faulty/corrupted file, or some other issue, with the device "files" under /dev/sda. Use the correct /dev/sdX on your system, for me it was /dev/sda. The fix ended up being:

  1. Unplug USB from computer
  2. doas rm -rf /dev/sda
  3. Plug USB back into computer

After that, writing worked fine again as normal, partitions were correctly found in lsblk and df, no space "issues", can write more than 10MB at a time, etc. Odd, but oh well, live and learn. Such is the life of a now part-time system admin without enough coffee.


source code for this site